package com.bwf.set;

import java.util.TreeSet;

/**
 * @Version v1.0
 * @Description: TODO
 * @Author ZHANZHONGXIN
 * @Date 2022/5/23 16:09
 * @Copyright 博为峰
 */
public class TreeSetDemo {
    public static void main(String[] args) {
//        m1();
//        m2();
        TreeSet treeSet = new TreeSet(new ComparatorImpl());
        treeSet.add(new Worker("张三", 20));
        treeSet.add(new Worker("李四", 30));
        System.out.println(treeSet);

    }

    private static void m2() {
        final TreeSet treeSet = new TreeSet();
        treeSet.add(new Student("张三", 20));
        treeSet.add(new Student("李四", 30));
        treeSet.add(new Student("王五", 50));
        treeSet.add(new Student("赵六", 60));
        System.out.println(treeSet);
    }

    private static void m1() {
        final TreeSet treeSet = new TreeSet();
        treeSet.add("b");
        treeSet.add("a");
        treeSet.add("c");
        treeSet.add("c");

        System.out.println(treeSet);
    }
}
